import React, { lazy } from "react";

const Home = lazy(() => import("@bi/Home"));
const Login = lazy(() => import("@bi/Login"));

const Funny = lazy(() => import("@bi/Funny"));
const More = lazy(() => import("@bi/More"));
const Find = lazy(() => import("@bi/Find"));
const Note = lazy(() => import("@bi/Note"));

const HistoryDetail = lazy(() => import("@bi/HistoryDetail"));

export const RoutersConfig: IRouterTypes.IRoutersConfig[] = [
    {
        "path": "/",
        "exact": true,
        "name": "root",
        "component": props => <Home {...props} />
    },
    {
        "path": "/login",
        "name": "Login",
        "exact": false,
        "component": props => <Login {...props} />
    },{
        "path": "/home",
        "name": "Home",
        "exact": false,
        "component": props => <Home {...props} />
    },
]

export const RoutersSecondConfig: IRouterTypes.IRoutersConfig[] = [
    {
        "path": "/home",
        "name": "homeRoot",
        "exact": true,
        "component": props => <Funny {...props} />,
        // "onEnter": (nextState,replaceState) => {
        //     console.log(`onEnter:nextState=${JSON.stringify(nextState)};replaceState=${replaceState}`);
        // },
        // "onLeave": (nextState,replaceState) => {
        //     console.log(`onLeave:nextState=${JSON.stringify(nextState)};replaceState=${replaceState}`);
        // }
    },
    {
        "path": "/home/Funny",
        "name": "Funny",
        "exact": true,
        "component": props => <Funny {...props} />,
    },{
        "path": "/home/Note",
        "name": "Note",
        "exact": true,
        "component": props => <Note {...props} />,
        // "onEnter": (nextState,replaceState) => {
        //     console.log(`onEnter:nextState=${JSON.stringify(nextState)};replaceState=${replaceState}`);
        // },
        // "onLeave": (nextState,replaceState) => {
        //     console.log(`onLeave:nextState=${JSON.stringify(nextState)};replaceState=${replaceState}`);
        // }
    },{
        "path": "/home/Find",
        "name": "Find",
        "exact": true,
        "component": props => <Find {...props} />
    },{
        "path": "/home/More",
        "name": "More",
        "exact": true,
        "component": props => <More {...props} />
    },
    {
        "path": "/home/Funny/HistoryDetail/:id",
        "name": "HistoryDetail",
        "exact": true,
        "component": props => <HistoryDetail {...props} />,
    }
]